import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShopAdminVO, ShopAdminForm, ShopAdminQuery } from '@/api/system/shopAdmin/types';

/**
 * 查询店铺管理员列表
 * @param query
 * @returns {*}
 */

export const listShopAdmin = (query?: ShopAdminQuery): AxiosPromise<ShopAdminVO[]> => {
  return request({
    url: '/system/shopAdmin/queryShopAdminList',
    method: 'get',
    params: query
  });
};

/**
 * 查询店铺管理员详细
 * @param id
 */
export const getShopAdmin = (id: string | number): AxiosPromise<ShopAdminVO> => {
  return request({
    url: '/system/shopAdmin/queryShopAdminInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增店铺管理员
 * @param data
 */
export const addShopAdmin = (data: ShopAdminForm) => {
  return request({
    url: '/system/shopAdmin/addShopAdmin',
    method: 'post',
    data: data
  });
};

/**
 * 修改店铺管理员
 * @param data
 */
export const updateShopAdmin = (data: ShopAdminForm) => {
  return request({
    url: '/system/shopAdmin/editShopAdmin',
    method: 'post',
    data: data
  });
};

/**
 * 删除店铺管理员
 * @param id
 */
export const delShopAdmin = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/shopAdmin/deleteShopAdmin/' + id,
    method: 'delete'
  });
};

/**
 * 重置密码
 */
export const resetPassword = (data: ShopAdminForm) => {
  return request({
    url: '/system/shopAdmin/resetPassword',
    method: 'post',
    data: data
  });
};
